package com.xyd.springcloud.controller;

import com.xyd.springcloud.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
public class UserController {

    // private static final String URL = "http://localhost:8081/";
    private static final String URL = "http://USER-PROVIDER/";

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/all")
    public List<User> getAllUsers() {
        return restTemplate.getForObject(URL + "all", List.class);
    }
}
